I'm going to copy one file using QFile::copy function but this function always returns false and errorString says :

"Cannot open D:/tmp/buf34.txt for input"
I tried to run this program with administrator privilege but nothing changed. My code is really simple :

Qt Code:
  1. QString source = url.toLocalFile();
  2. QString destination = _dir.absolutePath()
  3. + QString("/%1").arg(QFileInfo(source).fileName());
  4. qDebug()<<"Cp from :" << source << " to : "<< destination;
  5. QFile file(source);
  6. qDebug()<<file.copy(destination);
  7. qDebug()<<file.errorString();
To copy to clipboard, switch view to plain text mode 
I have QListView occupied with a QFileSystemModel. I try to drag one file from this ListView to a QLabel. For the QLabel a destination path is set. In drop event I try to copy file.